<!DOCTYPE HTML>
<html lang="zh-CN" data-rem="375">
<head>
    <meta charset="UTF-8">
    <title>{{$site['title']}}</title>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="keywords" content="{{$site['keywords']}}" />
    <meta name="description" content="{{$site['desc']}}" />
    <meta name="apple-mobile-web-app-capable" content="no" />
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="../css/style-index.css" />
    <link crossorigin="anonymous" integrity="sha384-vo50hXtn++/P8/rFjBxcsOVc14cJi9ibeQ96ujWvPfEmiojAoHF+bt7cOFv4wkHe" href="https://lib.baomitu.com/Swiper/3.4.2/css/swiper.min.css" rel="stylesheet">
</head>
<body>

<div class="page-nav">
    <span class="page-nav-title">首页</span>
    <a href="{{route('search')}}">
        <img src="../img/common/search-iocn.png" alt="" class="nav-search">
    </a>
</div>


<div class="page-swiper">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            @foreach($banner_list as $item)
                <a href="{{$item->url}}"> <div class="swiper-slide"><img src="{{$item->logo}}" alt="" class="swiper-pic"></div></a>
            @endforeach
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
    </div>
</div>

<div class="page-menu">
    <div class="menu-line">
        @foreach($cat_list_1 as $item)
            <a href="/project/type{{$item->id}}">
                <div class="menu-item">
                    <img src="{{$item->icon}}" alt="" class="menu-img" width="15px" height="25px">
                    <span class="menu-txt">{{$item->title}}</span>
                </div>
            </a>
        @endforeach
    </div>

    <div class="menu-line secn-menu-line">
        @foreach($cat_list_2 as $item)
            <a href="/project/type{{$item->id}}">
                <div class="menu-item">
                    <img src="{{$item->icon}}" alt="" class="menu-img" width="27px" height="28px">
                    <span class="menu-txt">{{$item->title}}</span>
                </div>
            </a>
        @endforeach
    </div>

</div>
<div class="divide"></div>

<div class="page-recommend">
    <div class="page-title">
        推荐项目
        <a href="/project">
            <img src="../img/common/arrow-right.png" alt="" class="arrow-right" >
        </a>
    </div>
    <div class="recommend-list">
        @foreach($rec_project_list as $item)
            <div class="recommend-item">
                <div class="recommend-item-top">
                    <img src="{{$item->adv_map[0]}}" alt="" class="recommend-item-img">
                </div>
                <div class="recommend-item-data">
                    <div class="recommend-item-name">{{$item->name}}</div>
                    <div class="recommend-item-company">{{$item->company_title}}</div>
                    <div class="recommend-price">投资金额: <strong class="price-num">{{$item->amount}}</strong>万</div>
                </div>
            </div>
        @endforeach
    </div>
</div>


<div class="page-tabs-sec">
    <ul class="tabs">
        @foreach($news_type_list as $key => $item)
            <li class="tab-item @if($key == 0) tab-item-active @endif" onclick="changeNewsTab(this, '{{$item->id}}')">
                <a href="javascript:void(0);">
                    {{$item->value}}
                </a>
            </li>
        @endforeach
    </ul>

    <div class="page-tabs-content">
        <div id="ajaxTabContent">
            <div class="goods-list">
                @foreach($news_list['list'] as $item)
                    <div class="goods-item">
                        <div class="goods-item-left">
                            <img src="{{$item->image_url}}" alt="" class="goods-img">
                        </div>
                        <div class="goods-item-right">
                            <div class="goods-name one-line">{{$item->name}}</div>
                            <div class="goods-detail two-line">{{$item->short_content}}</div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
        <div class="loadmore hasMore"><a href="javascript:void(0);">查看更多</a></div>
    </div>

</div>

<div class="page-footer">

    <div class="footer-item">
        <a href="/">
            <img src="/img/tabbar/tabbar-home-active.png" width="27px" height="24px" alt="" class="footer-img">
            <span class="footer-txt footer-txt-active">首页</span>
        </a>
    </div>
    <div class="footer-item">
        <a href="/project">
            <img src="/img/tabbar/tabbar-home.png" width="27px" height="24px" alt="" class="footer-img">
            <span class="footer-txt">项目部</span>
        </a>
    </div>
    <div class="footer-item">
        <a href="/news">
            <img src="/img/tabbar/tabbar-home.png" width="27px" height="24px" alt="" class="footer-img">
            <span class="footer-txt">创业资讯</span>
        </a>
    </div>
    <div class="footer-item">
        <a href="/rank">
            <img src="/img/tabbar/tabbar-home.png" width="27px" height="24px" alt="" class="footer-img">
            <span class="footer-txt">排行榜</span>
        </a>
    </div>


</div>



<script crossorigin="anonymous" integrity="sha384-qu2J8HSjv8EaYlbzBdbVeJncuCmfBqnZ4h3UIBZ9WTZ/5Wrqt0/9hofL0046NCkc" src="https://lib.baomitu.com/zepto/1.2.0/zepto.min.js"></script>
<script crossorigin="anonymous" integrity="sha384-guyT1zShzT+WsCqhaHnXwhZlUPPmZlXSrO1XOeTIgMc9frGsNZJJR7kiPTgXQRlq" src="https://lib.baomitu.com/Swiper/3.4.2/js/swiper.js"></script>
<script src="/js/utils.js"></script>
<script>
    var news_type = "{{$news_type_list[0]->id ?? 0}}", currentPage = 1, has_more_page;

    $(function () {
        var mySwiper = new Swiper('.swiper-container', {
            speed: 400,
            spaceBetween: 100,
            autoplay : true,
            // 如果需要分页器
            pagination: {
                el: '.swiper-pagination',
            },
        });

        $(".hasMore").click(function () {
            $.get("/ajaxNewsList?news_type=" + news_type+'&page=' + (currentPage+1), {}, function (result) {
                currentPage = parseInt($(result).find(".currentPage").val());
                has_more_page = $(result).find(".has_more_page").val();
                $("#ajaxTabContent").append(result);
                if (!has_more_page)
                    $(".hasMore").hide();
            });
        });
    });


    function changeNewsTab(obj, news_type_id) {
        news_type = news_type_id;
        $(obj).addClass('tab-item-active');
        $(obj).siblings().removeClass('tab-item-active');
        $.get("/ajaxNewsList?news_type=" + news_type_id, {}, function (result) {
            $(".hasMore").show();
            $("#ajaxTabContent").html(result);
            currentPage =  parseInt($(result).find(".currentPage").val());
            has_more_page = $(result).find(".has_more_page").val();
            if (!has_more_page)
                $(".hasMore").hide();
        });
    }

</script>
</body>
</html>